# JavaScript Reserved Words

« Previous
Next Chapter »

In JavaScript, some identifiers are reserved words and cannot be used as variables or function names.

## JavaScript Standards

All modern browsers fully support ECMAScript 3 (ES3, the third edition of JavaScript from 1999).

ECMAScript 4 (ES4) was never adopted.

ECMAScript 5 (ES5, released in 2009) is the latest official version of JavaScript.

Time passes, and we are now beginning to see complete support for ES5 in all modern browsers.

## JavaScript Reserved Words

In JavaScript you cannot use these reserved words as variables, labels, or function names:

abstract | arguments | boolean | break | byte
case | catch | char | class* | const
continue | debugger | default | delete | do
double | else | enum* | eval | export*
extends* | false | final | finally | float
for | function | goto | if | implements
import* | in | instanceof | int | interface
let | long | native | new | null
package | private | protected | public | return
short | static | super* | switch | synchronized
this | throw | throws | transient | true
try | typeof | var | void | volatile
while | with | yield |  |

Words marked with* are new in ECMAScript5

## JavaScript Objects, Properties, and Methods

You should also avoid using the name of JavaScript built-in objects, properties, and methods:

Array | Date | eval | function | hasOwnProperty
Infinity | isFinite | isNaN | isPrototypeOf | length
Math | NaN | name | Number | Object
prototype | String | toString | undefined | valueOf

## Java Reserved Words

JavaScript is often used together with Java. You should avoid using some Java objects and properties as JavaScript identifiers:

getClass | java | JavaArray | javaClass | JavaObject | JavaPackage

## Windows Reserved Words

JavaScript can be used outside HTML. It can be used as the programming language in many other applications.

In HTML you must (for portability you should) avoid using the name of HTML and Windows objects and properties:

alert | all | anchor | anchors | area
assign | blur | button | checkbox | clearInterval
clearTimeout | clientInformation | close | closed | confirm
constructor | crypto | decodeURI | decodeURIComponent | defaultStatus
document | element | elements | embed | embeds
encodeURI | encodeURIComponent | escape | event | fileUpload
focus | form | forms | frame | innerHeight
innerWidth | layer | layers | link | location
mimeTypes | navigate | navigator | frames | frameRate
hidden | history | image | images | offscreenBuffering
open | opener | option | outerHeight | outerWidth
packages | pageXOffset | pageYOffset | parent | parseFloat
parseInt | password | pkcs11 | plugin | prompt
propertyIsEnum | radio | reset | screenX | screenY
scroll | secure | select | self | setInterval
setTimeout | status | submit | taint | text
textarea | top | unescape | untaint | window

## HTML Event Handlers

In addition you should avoid using the name of all HTML event handlers.

Examples:

onblur | onclick | onerror | onfocus
onkeydown | onkeypress | onkeyup | onmouseover
onload | onmouseup | onmousedown | onsubmit

## Nonstandard JavaScript

In addition to reserved words, there are also some nonstandard keywords used in some JavaScript implementations.

One example is the const keyword used to define variables. Some JavaScript engines will treat const as a synonym to var. Other engines will treat const as a definition for read-only variables.

Const is an extension to JavaScript. It is supported by the JavaScript engine used in Firefox and Chrome. But it is not a part of the JavaScript standards ES3 or ES5. Do not use it.

« Previous
Next Chapter »

### WEB HOSTING

UK Reseller Hosting

### WEB BUILDING

FREE Website BUILDER Free HTML5 Templates

### W3SCHOOLS EXAMS

HTML, CSS, JavaScript, PHP, jQuery, XML, and ASP Certifications

### SHARE THIS PAGE

### Color Picker

### HTML/CSS

HTML Tutorial HTML5 Tutorial CSS Tutorial CSS3 Tutorial Bootstrap Tutorial

### JavaScript

JavaScript Tutorial jQuery Tutorial jQuery Mobile Tutorial AngularJS Tutorial AJAX Tutorial JSON Tutorial

### Graphics

Canvas Tutorial SVG Tutorial Google Maps Tutorial

### Server Side

SQL Tutorial PHP Tutorial ASP Tutorial ASP.NET Tutorial VBScript Tutorial AppML Tutorial

### Web

Web Building Web Statistics Web Certification

### XML

XML Tutorial DTD Tutorial Schema Tutorial XML DOM Tutorial XPath Tutorial XSLT Tutorial XQuery Tutorial XSL-FO Tutorial RSS Tutorial WSDL Tutorial

### HTML/CSS

HTML Tag Reference HTML Event Reference HTML Color Reference CSS 1,2,3 Reference Bootstrap Reference

### JavaScript

JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference Google Maps Reference

### Server Side

PHP Reference SQL Reference ASP Reference VBScript Reference Razor Reference ASP.NET Reference

### XML

XML DOM Reference XSLT Reference XSL-FO Reference XPath Reference XQuery Reference Schema Reference RSS Reference SVG Reference

### HTML Charsets

HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 HTML Symbols HTML UTF-8

### HTML/CSS

HTML Examples CSS Examples

### Browser Scripting

JavaScript Examples HTML DOM Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples

### Server Scripting

PHP Examples ASP Examples VBScript Examples Razor Examples .NET Examples

### XML Languages

XML Examples DTD Examples XML DOM Examples XSL Examples XSLT Examples XPath Examples XQuery Examples Schema Examples RSS Examples SVG Examples